#
# Hill, Seth J. and Chris Tausanovitch. "A Disconnect in Representation? Comparison of Trends in Congressional and Public Polarization."
#

library(pscl)
library(rjags)

load(file="senateMerged.RData")

adapt <- 500
iterations <- 10000
thin <- 1

print("Preparing the model...")
system.time(
  model <- jags.model(file="binary.jags",n.adapt=adapt,data=merged)
)
print("Running the model...")
system.time(
output <- coda.samples(model, variable.names=c("x","beta","alpha"),
                    n.iter=iterations,thin=thin)
          )
save("output","iterations","thin","merged",file="senateOutBig10k.RData")
